<extend name="Common/backend_base" />

<block name="content">
    <!-- 内容 -->
    <include file="Common:head" />

    <include file="Common:menu" />

    <div class="container">
        <div class="container-fluid">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-info-sign"></i>
                    </span>
                    <h5>添加用户</h5>
                </div>
                <div class="widget-content">
                    <form id="user-form" name="user-form" action="{:U('/user/add')}" method="post">
                        <table>
                            <tbody>
                                <tr>
                                    <th>角色：</th>
                                    <td>
                                        <select name="role">
                                            <option value="总部管理员">总部管理员</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <th>员工编号：</th>
                                    <td>
                                        <input name="code" type="text" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>姓名：</th>
                                    <td>
                                        <input name="name" type="text" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>邮箱：</th>
                                    <td>
                                        <input name="email" type="text" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>登陆密码：</th>
                                    <td>
                                        <input name="password" type="password" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>再次输入密码：</th>
                                    <td>
                                        <input name="repeat_password" type="password" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>QQ：</th>
                                    <td>
                                        <input name="qq" type="text" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>性别：</th>
                                    <td>
                                        <select name="sex">
                                            <option value="男">男</option>
                                            <option value="女">女</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <th>电话：</th>
                                    <td>
                                        <input name="mobile" type="text" value=""/>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <input class="btn" type="submit" value="添加"/>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- 内容 -->
</block>
<block name="script">
    <script type="application/javascript">
        requirejs(['jquery', 'require', 'jqueryForm', 'prompt'], function ($) {
            var prompt = require('prompt');

            $('#user-form').ajaxForm(function (json) {
                if (json.error.length > 0) {
                    prompt.error('添加用户失败');
                    return false;
                }

                prompt.alert('添加用户成功', 1000, function () {
                    document.location.href = '/user/list.html';
                });
            });
        });
    </script>
</block>